{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ff1f18bf",
   "metadata": {},
   "source": [
    "## Working with stock market data with the OpenBB Platform"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cd26e5c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import display\n",
    "from openbb import obb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "29cc5760",
   "metadata": {},
   "outputs": [],
   "source": [
    "obb.user.preferences.output_type = \"dataframe\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b67af6c7",
   "metadata": {},
   "source": [
    "Fetches historical price data for the equity \"SPY\" using the \"yfinance\" provider and displays the first 10 rows"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c9f33250",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = obb.equity.price.historical(\"SPY\", provider=\"yfinance\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "235092b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>split_ratio</th>\n",
       "      <th>dividend</th>\n",
       "      <th>capital_gains</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2023-06-20</th>\n",
       "      <td>437.450012</td>\n",
       "      <td>438.369995</td>\n",
       "      <td>435.029999</td>\n",
       "      <td>437.179993</td>\n",
       "      <td>76160400</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-21</th>\n",
       "      <td>436.160004</td>\n",
       "      <td>436.989990</td>\n",
       "      <td>434.329987</td>\n",
       "      <td>434.940002</td>\n",
       "      <td>76982300</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-22</th>\n",
       "      <td>433.950012</td>\n",
       "      <td>436.619995</td>\n",
       "      <td>433.600006</td>\n",
       "      <td>436.510010</td>\n",
       "      <td>70637200</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-23</th>\n",
       "      <td>432.929993</td>\n",
       "      <td>435.059998</td>\n",
       "      <td>432.470001</td>\n",
       "      <td>433.209991</td>\n",
       "      <td>92074500</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-26</th>\n",
       "      <td>432.619995</td>\n",
       "      <td>434.609985</td>\n",
       "      <td>431.190002</td>\n",
       "      <td>431.440002</td>\n",
       "      <td>72823600</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-27</th>\n",
       "      <td>432.350006</td>\n",
       "      <td>436.809998</td>\n",
       "      <td>431.880005</td>\n",
       "      <td>436.170013</td>\n",
       "      <td>72813700</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-28</th>\n",
       "      <td>435.049988</td>\n",
       "      <td>437.440002</td>\n",
       "      <td>434.410004</td>\n",
       "      <td>436.390015</td>\n",
       "      <td>75636000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-29</th>\n",
       "      <td>435.959991</td>\n",
       "      <td>438.279999</td>\n",
       "      <td>435.540009</td>\n",
       "      <td>438.109985</td>\n",
       "      <td>67882300</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-06-30</th>\n",
       "      <td>441.440002</td>\n",
       "      <td>444.299988</td>\n",
       "      <td>441.109985</td>\n",
       "      <td>443.279999</td>\n",
       "      <td>104921500</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-07-03</th>\n",
       "      <td>442.920013</td>\n",
       "      <td>444.079987</td>\n",
       "      <td>442.630005</td>\n",
       "      <td>443.790009</td>\n",
       "      <td>32793400</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  open        high         low       close     volume  \\\n",
       "date                                                                    \n",
       "2023-06-20  437.450012  438.369995  435.029999  437.179993   76160400   \n",
       "2023-06-21  436.160004  436.989990  434.329987  434.940002   76982300   \n",
       "2023-06-22  433.950012  436.619995  433.600006  436.510010   70637200   \n",
       "2023-06-23  432.929993  435.059998  432.470001  433.209991   92074500   \n",
       "2023-06-26  432.619995  434.609985  431.190002  431.440002   72823600   \n",
       "2023-06-27  432.350006  436.809998  431.880005  436.170013   72813700   \n",
       "2023-06-28  435.049988  437.440002  434.410004  436.390015   75636000   \n",
       "2023-06-29  435.959991  438.279999  435.540009  438.109985   67882300   \n",
       "2023-06-30  441.440002  444.299988  441.109985  443.279999  104921500   \n",
       "2023-07-03  442.920013  444.079987  442.630005  443.790009   32793400   \n",
       "\n",
       "            split_ratio  dividend  capital_gains  \n",
       "date                                              \n",
       "2023-06-20          0.0       0.0            0.0  \n",
       "2023-06-21          0.0       0.0            0.0  \n",
       "2023-06-22          0.0       0.0            0.0  \n",
       "2023-06-23          0.0       0.0            0.0  \n",
       "2023-06-26          0.0       0.0            0.0  \n",
       "2023-06-27          0.0       0.0            0.0  \n",
       "2023-06-28          0.0       0.0            0.0  \n",
       "2023-06-29          0.0       0.0            0.0  \n",
       "2023-06-30          0.0       0.0            0.0  \n",
       "2023-07-03          0.0       0.0            0.0  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(data.head(10))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3966d542",
   "metadata": {},
   "source": [
    "Fetches fundamental metrics for the equities \"AAPL\" and \"MSFT\" using the \"yfinance\" provider and transposes the dataframe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f695a877",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = obb.equity.fundamental.metrics(\"AAPL,MSFT\", provider=\"yfinance\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "834290bf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>symbol</th>\n",
       "      <td>AAPL</td>\n",
       "      <td>MSFT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>market_cap</th>\n",
       "      <td>3285944107008.0</td>\n",
       "      <td>3317337161728.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pe_ratio</th>\n",
       "      <td>33.326595</td>\n",
       "      <td>38.610725</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>forward_pe</th>\n",
       "      <td>29.435438</td>\n",
       "      <td>33.635265</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>peg_ratio</th>\n",
       "      <td>3.1</td>\n",
       "      <td>2.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>peg_ratio_ttm</th>\n",
       "      <td>2.268</td>\n",
       "      <td>2.2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>enterprise_to_ebitda</th>\n",
       "      <td>25.638</td>\n",
       "      <td>26.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>earnings_growth</th>\n",
       "      <td>0.007</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>earnings_growth_quarterly</th>\n",
       "      <td>-0.022</td>\n",
       "      <td>0.199</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>revenue_per_share</th>\n",
       "      <td>24.537</td>\n",
       "      <td>31.834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>revenue_growth</th>\n",
       "      <td>-0.043</td>\n",
       "      <td>0.17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>enterprise_to_revenue</th>\n",
       "      <td>8.709</td>\n",
       "      <td>14.133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>quick_ratio</th>\n",
       "      <td>0.875</td>\n",
       "      <td>1.132</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>current_ratio</th>\n",
       "      <td>1.037</td>\n",
       "      <td>1.242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>debt_to_equity</th>\n",
       "      <td>140.968</td>\n",
       "      <td>41.963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>gross_margin</th>\n",
       "      <td>0.45586</td>\n",
       "      <td>0.69894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>operating_margin</th>\n",
       "      <td>0.30743</td>\n",
       "      <td>0.44588</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ebitda_margin</th>\n",
       "      <td>0.33968</td>\n",
       "      <td>0.5325</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>profit_margin</th>\n",
       "      <td>0.26306</td>\n",
       "      <td>0.36427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>return_on_assets</th>\n",
       "      <td>0.22074</td>\n",
       "      <td>0.1541</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>return_on_equity</th>\n",
       "      <td>1.4725</td>\n",
       "      <td>0.38488</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dividend_yield</th>\n",
       "      <td>0.0047</td>\n",
       "      <td>0.0067</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dividend_yield_5y_avg</th>\n",
       "      <td>0.0071</td>\n",
       "      <td>0.0093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>payout_ratio</th>\n",
       "      <td>0.1493</td>\n",
       "      <td>0.2478</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>book_value</th>\n",
       "      <td>4.837</td>\n",
       "      <td>34.058</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>price_to_book</th>\n",
       "      <td>44.302254</td>\n",
       "      <td>13.105291</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>enterprise_value</th>\n",
       "      <td>3323380367360</td>\n",
       "      <td>3343551299584</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>overall_risk</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>audit_risk</th>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>board_risk</th>\n",
       "      <td>1.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>compensation_risk</th>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>shareholder_rights_risk</th>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>beta</th>\n",
       "      <td>1.25</td>\n",
       "      <td>0.893</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>price_return_1y</th>\n",
       "      <td>0.164873</td>\n",
       "      <td>0.33811</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>currency</th>\n",
       "      <td>USD</td>\n",
       "      <td>USD</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                         0                1\n",
       "symbol                                AAPL             MSFT\n",
       "market_cap                 3285944107008.0  3317337161728.0\n",
       "pe_ratio                         33.326595        38.610725\n",
       "forward_pe                       29.435438        33.635265\n",
       "peg_ratio                              3.1             2.33\n",
       "peg_ratio_ttm                        2.268           2.2007\n",
       "enterprise_to_ebitda                25.638            26.54\n",
       "earnings_growth                      0.007              0.2\n",
       "earnings_growth_quarterly           -0.022            0.199\n",
       "revenue_per_share                   24.537           31.834\n",
       "revenue_growth                      -0.043             0.17\n",
       "enterprise_to_revenue                8.709           14.133\n",
       "quick_ratio                          0.875            1.132\n",
       "current_ratio                        1.037            1.242\n",
       "debt_to_equity                     140.968           41.963\n",
       "gross_margin                       0.45586          0.69894\n",
       "operating_margin                   0.30743          0.44588\n",
       "ebitda_margin                      0.33968           0.5325\n",
       "profit_margin                      0.26306          0.36427\n",
       "return_on_assets                   0.22074           0.1541\n",
       "return_on_equity                    1.4725          0.38488\n",
       "dividend_yield                      0.0047           0.0067\n",
       "dividend_yield_5y_avg               0.0071           0.0093\n",
       "payout_ratio                        0.1493           0.2478\n",
       "book_value                           4.837           34.058\n",
       "price_to_book                    44.302254        13.105291\n",
       "enterprise_value             3323380367360    3343551299584\n",
       "overall_risk                           1.0              1.0\n",
       "audit_risk                             6.0              3.0\n",
       "board_risk                             1.0              4.0\n",
       "compensation_risk                      2.0              2.0\n",
       "shareholder_rights_risk                1.0              2.0\n",
       "beta                                  1.25            0.893\n",
       "price_return_1y                   0.164873          0.33811\n",
       "currency                               USD              USD"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(data.T)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e02fa775",
   "metadata": {},
   "source": [
    "Fetches valuation metrics for industries using the \"finviz\" provider and displays the data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c11ce353",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = obb.equity.compare.groups(\n",
    "    group=\"industry\", metric=\"valuation\", provider=\"finviz\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "57f1be9c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>market_cap</th>\n",
       "      <th>performance_1D</th>\n",
       "      <th>pe</th>\n",
       "      <th>forward_pe</th>\n",
       "      <th>peg</th>\n",
       "      <th>eps_growth_past_5_years</th>\n",
       "      <th>eps_growth_next_5_years</th>\n",
       "      <th>sales_growth_past_5_years</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_to_sales</th>\n",
       "      <th>price_to_book</th>\n",
       "      <th>price_to_cash</th>\n",
       "      <th>price_to_free_cash_flow</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Pharmaceutical Retailers</td>\n",
       "      <td>14240000000</td>\n",
       "      <td>0.0620</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-0.0476</td>\n",
       "      <td>-0.0759</td>\n",
       "      <td>0.0325</td>\n",
       "      <td>21970000</td>\n",
       "      <td>0.10</td>\n",
       "      <td>1.03</td>\n",
       "      <td>17.91</td>\n",
       "      <td>624.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Airlines</td>\n",
       "      <td>120040000000</td>\n",
       "      <td>-0.0059</td>\n",
       "      <td>10.77</td>\n",
       "      <td>6.81</td>\n",
       "      <td>0.63</td>\n",
       "      <td>-0.0069</td>\n",
       "      <td>0.1716</td>\n",
       "      <td>0.2553</td>\n",
       "      <td>58830000</td>\n",
       "      <td>0.46</td>\n",
       "      <td>2.18</td>\n",
       "      <td>2.27</td>\n",
       "      <td>42.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>REIT - Mortgage</td>\n",
       "      <td>55390000000</td>\n",
       "      <td>-0.0047</td>\n",
       "      <td>16.39</td>\n",
       "      <td>7.22</td>\n",
       "      <td>5.85</td>\n",
       "      <td>-0.2182</td>\n",
       "      <td>0.0280</td>\n",
       "      <td>0.3595</td>\n",
       "      <td>34970000</td>\n",
       "      <td>1.74</td>\n",
       "      <td>0.83</td>\n",
       "      <td>3.71</td>\n",
       "      <td>4.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Insurance - Reinsurance</td>\n",
       "      <td>51800000000</td>\n",
       "      <td>0.0072</td>\n",
       "      <td>7.48</td>\n",
       "      <td>7.33</td>\n",
       "      <td>1.01</td>\n",
       "      <td>0.5536</td>\n",
       "      <td>0.0743</td>\n",
       "      <td>0.4444</td>\n",
       "      <td>1850000</td>\n",
       "      <td>0.88</td>\n",
       "      <td>1.18</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Paper &amp; Paper Products</td>\n",
       "      <td>15840000000</td>\n",
       "      <td>-0.0047</td>\n",
       "      <td>7.53</td>\n",
       "      <td>7.69</td>\n",
       "      <td>0.98</td>\n",
       "      <td>0.7285</td>\n",
       "      <td>0.0768</td>\n",
       "      <td>0.1597</td>\n",
       "      <td>2420000</td>\n",
       "      <td>0.94</td>\n",
       "      <td>1.38</td>\n",
       "      <td>3.64</td>\n",
       "      <td>24.14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>REIT - Healthcare Facilities</td>\n",
       "      <td>130060000000</td>\n",
       "      <td>0.0028</td>\n",
       "      <td>97.68</td>\n",
       "      <td>47.09</td>\n",
       "      <td>47.62</td>\n",
       "      <td>-0.1295</td>\n",
       "      <td>0.0205</td>\n",
       "      <td>0.0992</td>\n",
       "      <td>27060000</td>\n",
       "      <td>5.73</td>\n",
       "      <td>1.71</td>\n",
       "      <td>26.23</td>\n",
       "      <td>22.93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>REIT - Residential</td>\n",
       "      <td>192710000000</td>\n",
       "      <td>0.0075</td>\n",
       "      <td>33.80</td>\n",
       "      <td>47.57</td>\n",
       "      <td>11.79</td>\n",
       "      <td>0.1426</td>\n",
       "      <td>0.0287</td>\n",
       "      <td>0.0796</td>\n",
       "      <td>22810000</td>\n",
       "      <td>7.71</td>\n",
       "      <td>2.45</td>\n",
       "      <td>58.16</td>\n",
       "      <td>22.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>Shell Companies</td>\n",
       "      <td>25470000000</td>\n",
       "      <td>0.0002</td>\n",
       "      <td>43.33</td>\n",
       "      <td>129.26</td>\n",
       "      <td>2.89</td>\n",
       "      <td>0.4287</td>\n",
       "      <td>0.1500</td>\n",
       "      <td>0.5790</td>\n",
       "      <td>8780000</td>\n",
       "      <td>45.15</td>\n",
       "      <td>2.06</td>\n",
       "      <td>36.13</td>\n",
       "      <td>101.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>Infrastructure Operations</td>\n",
       "      <td>33290000000</td>\n",
       "      <td>0.0132</td>\n",
       "      <td>56.84</td>\n",
       "      <td>142.62</td>\n",
       "      <td>4.18</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.1360</td>\n",
       "      <td>0.0817</td>\n",
       "      <td>1190000</td>\n",
       "      <td>3.31</td>\n",
       "      <td>7.04</td>\n",
       "      <td>6.10</td>\n",
       "      <td>27.69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>Real Estate - Diversified</td>\n",
       "      <td>6670000000</td>\n",
       "      <td>-0.0161</td>\n",
       "      <td>74.91</td>\n",
       "      <td>167.57</td>\n",
       "      <td>3.78</td>\n",
       "      <td>0.1824</td>\n",
       "      <td>0.1981</td>\n",
       "      <td>0.2145</td>\n",
       "      <td>447720</td>\n",
       "      <td>4.48</td>\n",
       "      <td>1.72</td>\n",
       "      <td>6.54</td>\n",
       "      <td>58.01</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>145 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                             name    market_cap  performance_1D     pe  \\\n",
       "0        Pharmaceutical Retailers   14240000000          0.0620    NaN   \n",
       "1                        Airlines  120040000000         -0.0059  10.77   \n",
       "2                 REIT - Mortgage   55390000000         -0.0047  16.39   \n",
       "3         Insurance - Reinsurance   51800000000          0.0072   7.48   \n",
       "4          Paper & Paper Products   15840000000         -0.0047   7.53   \n",
       "..                            ...           ...             ...    ...   \n",
       "140  REIT - Healthcare Facilities  130060000000          0.0028  97.68   \n",
       "141            REIT - Residential  192710000000          0.0075  33.80   \n",
       "142               Shell Companies   25470000000          0.0002  43.33   \n",
       "143     Infrastructure Operations   33290000000          0.0132  56.84   \n",
       "144     Real Estate - Diversified    6670000000         -0.0161  74.91   \n",
       "\n",
       "     forward_pe    peg  eps_growth_past_5_years  eps_growth_next_5_years  \\\n",
       "0          5.29    NaN                  -0.0476                  -0.0759   \n",
       "1          6.81   0.63                  -0.0069                   0.1716   \n",
       "2          7.22   5.85                  -0.2182                   0.0280   \n",
       "3          7.33   1.01                   0.5536                   0.0743   \n",
       "4          7.69   0.98                   0.7285                   0.0768   \n",
       "..          ...    ...                      ...                      ...   \n",
       "140       47.09  47.62                  -0.1295                   0.0205   \n",
       "141       47.57  11.79                   0.1426                   0.0287   \n",
       "142      129.26   2.89                   0.4287                   0.1500   \n",
       "143      142.62   4.18                      NaN                   0.1360   \n",
       "144      167.57   3.78                   0.1824                   0.1981   \n",
       "\n",
       "     sales_growth_past_5_years    volume  price_to_sales  price_to_book  \\\n",
       "0                       0.0325  21970000            0.10           1.03   \n",
       "1                       0.2553  58830000            0.46           2.18   \n",
       "2                       0.3595  34970000            1.74           0.83   \n",
       "3                       0.4444   1850000            0.88           1.18   \n",
       "4                       0.1597   2420000            0.94           1.38   \n",
       "..                         ...       ...             ...            ...   \n",
       "140                     0.0992  27060000            5.73           1.71   \n",
       "141                     0.0796  22810000            7.71           2.45   \n",
       "142                     0.5790   8780000           45.15           2.06   \n",
       "143                     0.0817   1190000            3.31           7.04   \n",
       "144                     0.2145    447720            4.48           1.72   \n",
       "\n",
       "     price_to_cash  price_to_free_cash_flow  \n",
       "0            17.91                   624.33  \n",
       "1             2.27                    42.86  \n",
       "2             3.71                     4.89  \n",
       "3              NaN                     2.96  \n",
       "4             3.64                    24.14  \n",
       "..             ...                      ...  \n",
       "140          26.23                    22.93  \n",
       "141          58.16                    22.24  \n",
       "142          36.13                   101.48  \n",
       "143           6.10                    27.69  \n",
       "144           6.54                    58.01  \n",
       "\n",
       "[145 rows x 14 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1f26fce5",
   "metadata": {},
   "source": [
    "Fetches performance metrics for industries using the \"finviz\" provider and displays the data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c47b4050",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = obb.equity.compare.groups(\n",
    "    group=\"industry\", metric=\"performance\", provider=\"finviz\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2b684932",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>performance_1D</th>\n",
       "      <th>performance_1W</th>\n",
       "      <th>performance_1M</th>\n",
       "      <th>performance_3M</th>\n",
       "      <th>performance_6M</th>\n",
       "      <th>performance_1Y</th>\n",
       "      <th>performance_YTD</th>\n",
       "      <th>analyst_recommendation</th>\n",
       "      <th>volume</th>\n",
       "      <th>volume_average</th>\n",
       "      <th>volume_relative</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Solar</td>\n",
       "      <td>-0.0012</td>\n",
       "      <td>-0.0960</td>\n",
       "      <td>0.1578</td>\n",
       "      <td>0.1994</td>\n",
       "      <td>-0.0087</td>\n",
       "      <td>-0.3186</td>\n",
       "      <td>-0.0304</td>\n",
       "      <td>1.88</td>\n",
       "      <td>65900000</td>\n",
       "      <td>99080000</td>\n",
       "      <td>0.67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Luxury Goods</td>\n",
       "      <td>-0.0109</td>\n",
       "      <td>-0.0642</td>\n",
       "      <td>-0.0615</td>\n",
       "      <td>-0.1498</td>\n",
       "      <td>-0.0660</td>\n",
       "      <td>0.0155</td>\n",
       "      <td>-0.0860</td>\n",
       "      <td>2.05</td>\n",
       "      <td>8600000</td>\n",
       "      <td>9230000</td>\n",
       "      <td>0.93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Broadcasting</td>\n",
       "      <td>-0.0058</td>\n",
       "      <td>-0.0607</td>\n",
       "      <td>-0.1518</td>\n",
       "      <td>-0.1392</td>\n",
       "      <td>-0.3850</td>\n",
       "      <td>-0.4042</td>\n",
       "      <td>-0.3889</td>\n",
       "      <td>2.09</td>\n",
       "      <td>26160000</td>\n",
       "      <td>19940000</td>\n",
       "      <td>1.31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Health Information Services</td>\n",
       "      <td>-0.0113</td>\n",
       "      <td>-0.0491</td>\n",
       "      <td>-0.0947</td>\n",
       "      <td>-0.1971</td>\n",
       "      <td>-0.1322</td>\n",
       "      <td>-0.2640</td>\n",
       "      <td>-0.1767</td>\n",
       "      <td>2.00</td>\n",
       "      <td>47830000</td>\n",
       "      <td>79430000</td>\n",
       "      <td>0.60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Infrastructure Operations</td>\n",
       "      <td>0.0132</td>\n",
       "      <td>-0.0460</td>\n",
       "      <td>-0.0376</td>\n",
       "      <td>0.0465</td>\n",
       "      <td>0.1195</td>\n",
       "      <td>0.2399</td>\n",
       "      <td>0.0883</td>\n",
       "      <td>1.57</td>\n",
       "      <td>1190000</td>\n",
       "      <td>940060</td>\n",
       "      <td>1.26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>Uranium</td>\n",
       "      <td>0.0193</td>\n",
       "      <td>0.0419</td>\n",
       "      <td>-0.0497</td>\n",
       "      <td>0.1716</td>\n",
       "      <td>0.1057</td>\n",
       "      <td>0.5910</td>\n",
       "      <td>0.1296</td>\n",
       "      <td>1.31</td>\n",
       "      <td>25020000</td>\n",
       "      <td>40580000</td>\n",
       "      <td>0.62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>Home Improvement Retail</td>\n",
       "      <td>0.0104</td>\n",
       "      <td>0.0503</td>\n",
       "      <td>0.0166</td>\n",
       "      <td>-0.0681</td>\n",
       "      <td>0.0060</td>\n",
       "      <td>0.1453</td>\n",
       "      <td>0.0246</td>\n",
       "      <td>2.15</td>\n",
       "      <td>8490000</td>\n",
       "      <td>8950000</td>\n",
       "      <td>0.95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>Semiconductor Equipment &amp; Materials</td>\n",
       "      <td>0.0148</td>\n",
       "      <td>0.0542</td>\n",
       "      <td>0.1549</td>\n",
       "      <td>0.1729</td>\n",
       "      <td>0.4212</td>\n",
       "      <td>0.5839</td>\n",
       "      <td>0.4134</td>\n",
       "      <td>1.79</td>\n",
       "      <td>25650000</td>\n",
       "      <td>23160000</td>\n",
       "      <td>1.11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>Computer Hardware</td>\n",
       "      <td>0.0206</td>\n",
       "      <td>0.0923</td>\n",
       "      <td>0.0647</td>\n",
       "      <td>0.2177</td>\n",
       "      <td>0.6109</td>\n",
       "      <td>1.0562</td>\n",
       "      <td>0.5995</td>\n",
       "      <td>1.94</td>\n",
       "      <td>106860000</td>\n",
       "      <td>74780000</td>\n",
       "      <td>1.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>Semiconductors</td>\n",
       "      <td>0.0208</td>\n",
       "      <td>0.1069</td>\n",
       "      <td>0.2870</td>\n",
       "      <td>0.3582</td>\n",
       "      <td>0.8459</td>\n",
       "      <td>1.0597</td>\n",
       "      <td>0.8176</td>\n",
       "      <td>1.53</td>\n",
       "      <td>573540000</td>\n",
       "      <td>703100000</td>\n",
       "      <td>0.82</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>145 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                    name  performance_1D  performance_1W  \\\n",
       "0                                  Solar         -0.0012         -0.0960   \n",
       "1                           Luxury Goods         -0.0109         -0.0642   \n",
       "2                           Broadcasting         -0.0058         -0.0607   \n",
       "3            Health Information Services         -0.0113         -0.0491   \n",
       "4              Infrastructure Operations          0.0132         -0.0460   \n",
       "..                                   ...             ...             ...   \n",
       "140                              Uranium          0.0193          0.0419   \n",
       "141              Home Improvement Retail          0.0104          0.0503   \n",
       "142  Semiconductor Equipment & Materials          0.0148          0.0542   \n",
       "143                    Computer Hardware          0.0206          0.0923   \n",
       "144                       Semiconductors          0.0208          0.1069   \n",
       "\n",
       "     performance_1M  performance_3M  performance_6M  performance_1Y  \\\n",
       "0            0.1578          0.1994         -0.0087         -0.3186   \n",
       "1           -0.0615         -0.1498         -0.0660          0.0155   \n",
       "2           -0.1518         -0.1392         -0.3850         -0.4042   \n",
       "3           -0.0947         -0.1971         -0.1322         -0.2640   \n",
       "4           -0.0376          0.0465          0.1195          0.2399   \n",
       "..              ...             ...             ...             ...   \n",
       "140         -0.0497          0.1716          0.1057          0.5910   \n",
       "141          0.0166         -0.0681          0.0060          0.1453   \n",
       "142          0.1549          0.1729          0.4212          0.5839   \n",
       "143          0.0647          0.2177          0.6109          1.0562   \n",
       "144          0.2870          0.3582          0.8459          1.0597   \n",
       "\n",
       "     performance_YTD  analyst_recommendation     volume  volume_average  \\\n",
       "0            -0.0304                    1.88   65900000        99080000   \n",
       "1            -0.0860                    2.05    8600000         9230000   \n",
       "2            -0.3889                    2.09   26160000        19940000   \n",
       "3            -0.1767                    2.00   47830000        79430000   \n",
       "4             0.0883                    1.57    1190000          940060   \n",
       "..               ...                     ...        ...             ...   \n",
       "140           0.1296                    1.31   25020000        40580000   \n",
       "141           0.0246                    2.15    8490000         8950000   \n",
       "142           0.4134                    1.79   25650000        23160000   \n",
       "143           0.5995                    1.94  106860000        74780000   \n",
       "144           0.8176                    1.53  573540000       703100000   \n",
       "\n",
       "     volume_relative  \n",
       "0               0.67  \n",
       "1               0.93  \n",
       "2               1.31  \n",
       "3               0.60  \n",
       "4               1.26  \n",
       "..               ...  \n",
       "140             0.62  \n",
       "141             0.95  \n",
       "142             1.11  \n",
       "143             1.43  \n",
       "144             0.82  \n",
       "\n",
       "[145 rows x 12 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "19077fff",
   "metadata": {},
   "source": [
    "Fetches overview metrics for industries using the \"finviz\" provider and displays the data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "0bb532b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = obb.equity.compare.groups(group=\"industry\", metric=\"overview\", provider=\"finviz\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "9d4def67",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>stocks</th>\n",
       "      <th>market_cap</th>\n",
       "      <th>performance_1D</th>\n",
       "      <th>dividend_yield</th>\n",
       "      <th>pe</th>\n",
       "      <th>forward_pe</th>\n",
       "      <th>peg</th>\n",
       "      <th>float_short</th>\n",
       "      <th>volume</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Residential Construction</td>\n",
       "      <td>21</td>\n",
       "      <td>195630000000</td>\n",
       "      <td>-0.0291</td>\n",
       "      <td>0.0076</td>\n",
       "      <td>9.91</td>\n",
       "      <td>9.28</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0.0328</td>\n",
       "      <td>20180000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Real Estate - Diversified</td>\n",
       "      <td>5</td>\n",
       "      <td>6670000000</td>\n",
       "      <td>-0.0161</td>\n",
       "      <td>0.0042</td>\n",
       "      <td>74.91</td>\n",
       "      <td>167.57</td>\n",
       "      <td>3.78</td>\n",
       "      <td>0.0261</td>\n",
       "      <td>447720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Healthcare Plans</td>\n",
       "      <td>11</td>\n",
       "      <td>839070000000</td>\n",
       "      <td>-0.0127</td>\n",
       "      <td>0.0172</td>\n",
       "      <td>22.36</td>\n",
       "      <td>12.83</td>\n",
       "      <td>2.05</td>\n",
       "      <td>0.0249</td>\n",
       "      <td>25010000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Internet Content &amp; Information</td>\n",
       "      <td>69</td>\n",
       "      <td>5905590000000</td>\n",
       "      <td>-0.0123</td>\n",
       "      <td>0.0024</td>\n",
       "      <td>28.10</td>\n",
       "      <td>20.95</td>\n",
       "      <td>1.27</td>\n",
       "      <td>0.0213</td>\n",
       "      <td>137410000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Auto Parts</td>\n",
       "      <td>50</td>\n",
       "      <td>157300000000</td>\n",
       "      <td>-0.0116</td>\n",
       "      <td>0.0150</td>\n",
       "      <td>15.29</td>\n",
       "      <td>10.59</td>\n",
       "      <td>0.80</td>\n",
       "      <td>0.0644</td>\n",
       "      <td>44230000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>Computer Hardware</td>\n",
       "      <td>36</td>\n",
       "      <td>421920000000</td>\n",
       "      <td>0.0206</td>\n",
       "      <td>0.0086</td>\n",
       "      <td>36.99</td>\n",
       "      <td>19.35</td>\n",
       "      <td>2.10</td>\n",
       "      <td>0.0559</td>\n",
       "      <td>106860000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>Semiconductors</td>\n",
       "      <td>68</td>\n",
       "      <td>6883190000000</td>\n",
       "      <td>0.0208</td>\n",
       "      <td>0.0057</td>\n",
       "      <td>57.70</td>\n",
       "      <td>29.74</td>\n",
       "      <td>1.85</td>\n",
       "      <td>0.0178</td>\n",
       "      <td>573540000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>Utilities - Independent Power Producers</td>\n",
       "      <td>5</td>\n",
       "      <td>53020000000</td>\n",
       "      <td>0.0290</td>\n",
       "      <td>0.0172</td>\n",
       "      <td>18.10</td>\n",
       "      <td>12.99</td>\n",
       "      <td>3.44</td>\n",
       "      <td>0.0326</td>\n",
       "      <td>13100000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>Utilities - Renewable</td>\n",
       "      <td>25</td>\n",
       "      <td>177620000000</td>\n",
       "      <td>0.0338</td>\n",
       "      <td>0.0182</td>\n",
       "      <td>33.80</td>\n",
       "      <td>24.32</td>\n",
       "      <td>2.61</td>\n",
       "      <td>0.0347</td>\n",
       "      <td>28880000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>Pharmaceutical Retailers</td>\n",
       "      <td>8</td>\n",
       "      <td>14240000000</td>\n",
       "      <td>0.0620</td>\n",
       "      <td>0.0929</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0617</td>\n",
       "      <td>21970000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>145 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                        name  stocks     market_cap  \\\n",
       "0                   Residential Construction      21   195630000000   \n",
       "1                  Real Estate - Diversified       5     6670000000   \n",
       "2                           Healthcare Plans      11   839070000000   \n",
       "3             Internet Content & Information      69  5905590000000   \n",
       "4                                 Auto Parts      50   157300000000   \n",
       "..                                       ...     ...            ...   \n",
       "140                        Computer Hardware      36   421920000000   \n",
       "141                           Semiconductors      68  6883190000000   \n",
       "142  Utilities - Independent Power Producers       5    53020000000   \n",
       "143                    Utilities - Renewable      25   177620000000   \n",
       "144                 Pharmaceutical Retailers       8    14240000000   \n",
       "\n",
       "     performance_1D  dividend_yield     pe  forward_pe   peg  float_short  \\\n",
       "0           -0.0291          0.0076   9.91        9.28  2.47       0.0328   \n",
       "1           -0.0161          0.0042  74.91      167.57  3.78       0.0261   \n",
       "2           -0.0127          0.0172  22.36       12.83  2.05       0.0249   \n",
       "3           -0.0123          0.0024  28.10       20.95  1.27       0.0213   \n",
       "4           -0.0116          0.0150  15.29       10.59  0.80       0.0644   \n",
       "..              ...             ...    ...         ...   ...          ...   \n",
       "140          0.0206          0.0086  36.99       19.35  2.10       0.0559   \n",
       "141          0.0208          0.0057  57.70       29.74  1.85       0.0178   \n",
       "142          0.0290          0.0172  18.10       12.99  3.44       0.0326   \n",
       "143          0.0338          0.0182  33.80       24.32  2.61       0.0347   \n",
       "144          0.0620          0.0929    NaN        5.29   NaN       0.0617   \n",
       "\n",
       "        volume  \n",
       "0     20180000  \n",
       "1       447720  \n",
       "2     25010000  \n",
       "3    137410000  \n",
       "4     44230000  \n",
       "..         ...  \n",
       "140  106860000  \n",
       "141  573540000  \n",
       "142   13100000  \n",
       "143   28880000  \n",
       "144   21970000  \n",
       "\n",
       "[145 rows x 10 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2415554c",
   "metadata": {},
   "source": [
    "**Jason Strimpel** is the founder of <a href='https://pyquantnews.com/'>PyQuant News</a> and co-founder of <a href='https://www.tradeblotter.io/'>Trade Blotter</a>. His career in algorithmic trading spans 20+ years. He previously traded for a Chicago-based hedge fund, was a risk manager at JPMorgan, and managed production risk technology for an energy derivatives trading firm in London. In Singapore, he served as APAC CIO for an agricultural trading firm and built the data science team for a global metals trading firm. Jason holds degrees in Finance and Economics and a Master's in Quantitative Finance from the Illinois Institute of Technology. His career spans America, Europe, and Asia. He shares his expertise through the <a href='https://pyquantnews.com/subscribe-to-the-pyquant-newsletter/'>PyQuant Newsletter</a>, social media, and has taught over 1,000+ algorithmic trading with Python in his popular course **<a href='https://gettingstartedwithpythonforquantfinance.com/'>Getting Started With Python for Quant Finance</a>**. All code is for educational purposes only. Nothing provided here is financial advise. Use at your own risk."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9a9ed35b-1b0d-44b7-b42f-5c3424bd79d7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
